<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../gsap.min.js"></script>
  <script src="../gsap-public/minified/ScrollTrigger.min.js"></script>
  <script src="../gsap-public/minified/ScrollToPlugin.min.js"></script>
  <style>
    * {
      padding: 0;
      margin: 0;
    }
    body {
      background-color: black;
    }

    .box {
      height: 300px;
      background-color: black;
    }

    @media (min-width: 1024px) {
      #shadow-box {
        position: relative;
        width: 100vw;
        height: 100vh;
        overflow: hidden;
        border: white 1px solid;
        box-sizing: border-box;
      }

      #shadow-box::before {
        content: " ";
        display: block;
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        height: 11%;
        background: linear-gradient(180deg, #000 33%, transparent 100%);
        z-index: 1;
      }
      #shadow-box::after {
        content: " ";
        display: block;
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 11%;
        background: linear-gradient(0, #000 33%, transparent 100%);
      }
      #director-screen {
        width: 100%;
        height: 100%;
        transform: translate(-10%, 0) scale(3.5, 3.5);
        transform-origin: center;
        margin: 0;
        padding: 0;
        z-index: 1;
      }

      .video {
        width: 100%;
      }

      .cover-img {
        position: absolute;
        width: 100%;
      }
    }
  </style>
</head>

<body>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div id="shadow-box">
    <div id="director-screen">
      <img class="cover-img"
        src="http://localhost:8080/cn/assets/src/components/product/fussi/director/assets/screen-frame.png" alt="">
      <video class="video"
        src="http://localhost:8080/cn/assets/src/components/product/fussi/director/assets/cafe.mp4">您的浏览器不支持该视频</video>
    </div>
  </div>

  <div class="box"></div>
  <div class="box"></div>
  <script>
    gsap.registerPlugin(ScrollTrigger);
    if (screen.width >= 1024) {
      gsap.to('#director-screen', {
        scrollTrigger: {
          start: 'top top',
          trigger: '#director-screen',
          end: 'bottom center',
          ease: 'ease-out',
          toggleActions: 'restart pause reverse none',
          scrub: 0.03,
          markers: true,
        },
        transform: 'translate(10%, 0) scale(0.8, 0.8)',
      });

      gsap.to('#shadow-box', {
        scrollTrigger: {
          trigger: '#shadow-box',
          start: 'top top',
          end: 'bottom top',
          toggleActions: 'restart pause reverse none',
          scrub: 0.03,
          markers: true
        },
        transform: `translate(0, ${document.querySelector('#shadowBox').offsetHeight})`
      });
    }
  </script>
</body>

</html>